package com.lzc.jobrecomendbackend.controller.salary;

import com.lzc.jobrecomendbackend.common.ApiResponse;
import com.lzc.jobrecomendbackend.model.salary.CityCompareVO;
import com.lzc.jobrecomendbackend.model.salary.SalaryDistributionVO;
import com.lzc.jobrecomendbackend.service.salary.SalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 薪资分析控制器
 */
@RestController
@RequestMapping("/api/salary")
public class SalaryController {

    @Autowired
    private SalaryService salaryService;
    
    /**
     * 获取薪资分布
     * 
     * @param city 城市（可选）
     * @param education 学历要求（可选）
     * @param experience 经验要求（可选）
     * @return 薪资分布结果
     */
    @GetMapping("/distribution")
    public ApiResponse<List<SalaryDistributionVO>> getSalaryDistribution(
            @RequestParam(required = false) String city,
            @RequestParam(required = false) String education,
            @RequestParam(required = false) String experience) {
        
        List<SalaryDistributionVO> result = salaryService.getSalaryDistribution(city, education, experience);
        return ApiResponse.success(result);
    }
    
    /**
     * 获取三地薪资对比
     * 
     * @param education 学历要求（可选）
     * @param experience 经验要求（可选）
     * @param positionKeyword 职位关键词（可选）
     * @return 三地薪资对比结果
     */
    @GetMapping("/city_compare")
    public ApiResponse<List<CityCompareVO>> getCityCompare(
            @RequestParam(required = false) String education,
            @RequestParam(required = false) String experience,
            @RequestParam(required = false) String positionKeyword) {
        
        List<CityCompareVO> result = salaryService.getCityCompare(education, experience, positionKeyword);
        return ApiResponse.success(result);
    }
} 